<?php

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$user		= JFactory::getUser();
$userId		= $user->get('id');

?>

<form action="<?php echo JRoute::_('index.php?option=com_bakerys&view=orders'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
	<?php else : ?>
		<div id="j-main-container">
	<?php endif;?>
		<div id="filter-bar" class="btn-toolbar">		
			
		</div>
		<div class="clearfix"> </div>
		<table class="table table-striped table-bordered" id="bakeryList">
			<thead>
				<tr>					
					<th width="4%" style="text-align:center" class="hidden-phone">
						<input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
					</th>					
					<th class="title center" width="30%">
						Customer name
					</th>
					<th class="title center" >
						Order date
					</th>
					<th class="title center" >
						Address
					</th>	
					<th class="title center" width="12%"  >
						Zip code
					</th>
					<th class="title center" width="12%" >
						City
					</th>	
					<th class="title center" width="6%">
						State
					</th>					
					<th width="5%" style="min-width:55px" class="nowrap center">
						Mobile
					</th>	
					<th width="5%" style="min-width:55px" class="nowrap center">
						Email
					</th>
					<th width="5%" style="min-width:55px" class="nowrap center">
						Delivery
					</th>		
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="10">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php foreach ($this->items as $i => $item) :?>
				<tr class="row<?php echo $i % 2; ?>" >					
					<td class="center hidden-phone">
						<?php echo JHtml::_('grid.id', $i, $item->id); ?>
					</td>					
					<td class="nowrap has-context">
						<?php echo $this->escape($item->customer_name); ?>					
					</td>					
					<td class="nowrap has-context">						
						<?php echo $this->escape($item->order_date); ?>									
					</td>	
					<td class="nowrap has-context">						
						<?php echo $this->escape($item->address); ?>									
					</td>
					<td class="nowrap has-context">
						<?php echo $this->escape($item->zipcode); ?>
					</td>	
					<td class="nowrap has-context" style="text-align:center">
						<?php echo $this->escape($item->city); ?>
					</td>
					<td class="nowrap has-context" style="text-align:center">
						<?php echo $this->escape($item->states); ?>
					</td>					
					<td class="nowrap has-context" style="text-align:center">
						<?php echo $this->escape($item->mobile); ?>
					</td>
					<td class="nowrap has-context" style="text-align:center">
						<?php echo $this->escape($item->email); ?>
					</td>
					<td class="nowrap has-context" style="text-align:center">
						<?php if($item->status): ?>
							<a class="btn btn-micro active" href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i ?>','orders.undelivered')" title="Undelivered Item">
								<i class="icon-publish"></i>
							</a>
						<?php else: ?>
							<a class="btn btn-micro" href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i ?>','orders.delivery')" title="Delivery Item">
								<i class="icon-unpublish"></i>
							</a>
						<?php endif; ?>
					</td>					
				</tr>
				<?php endforeach; ?>
			</tbody>
		</table>		
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
		<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
